package com.lovebugs.xgrid.tags;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lovebugs.AbstractTag;
import com.lovebugs.OgnlContext;
import com.lovebugs.UIBean;
import com.lovebugs.xgrid.components.Grid;

public class GridTag extends AbstractTag {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
    private String name;
	
	private String url;
	
	private String checkbox = "true";
	
	private String bbar;
	
	private String apply;
	
	private String width;
	
	private String checkonly;
	
	private String autoload="true";
	
	private String columnLines = "false";
	
	private String pagec = "15";

	private String view;

	private String gtpl;

	private String gsortinfo;

	private String gfield;

	private String gtotalfield;
	
	public UIBean getUIBean(OgnlContext ognlContext,HttpServletRequest req,HttpServletResponse resp) {
		return new Grid(ognlContext,req,resp);
	}
	
	public void populateParams() { 
		Grid grid = (Grid)this.getComponent();
		grid.setName(name);
		grid.setApply(apply);
		grid.setAutoload(Boolean.parseBoolean(autoload));
		grid.setBbar(Boolean.parseBoolean(bbar));
		grid.setCheckbox(Boolean.parseBoolean(checkbox));
		grid.setCheckonly(checkonly);
		grid.setColumnLines(Boolean.parseBoolean(columnLines));
		grid.setGfield(gfield);
		grid.setGsortinfo(gsortinfo);
		grid.setGtotalfield(gtotalfield);
		grid.setGtpl(gtpl);
		grid.setUrl(url);
		grid.setPagec(pagec);
		grid.setWidth(width);
		grid.setView(view);
	}
	
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}


	public String getApply() {
		return apply;
	}

	public void setApply(String apply) {
		this.apply = apply;
	}

	public String getCheckonly() {
		return checkonly;
	}

	public void setCheckonly(String checkonly) {
		this.checkonly = checkonly;
	}

	public String getView() {
		return view;
	}

	public void setView(String view) {
		this.view = view;
	}

	public String getWidth() {
		return width;
	}

	public void setWidth(String width) {
		this.width = width;
	}

	public String getAutoload() {
		return autoload;
	}

	public void setAutoload(String autoload) {
		this.autoload = autoload;
	}

	public String getBbar() {
		return bbar;
	}

	public void setBbar(String bbar) {
		this.bbar = bbar;
	}

	public String getCheckbox() {
		return checkbox;
	}

	public void setCheckbox(String checkbox) {
		this.checkbox = checkbox;
	}

	public String getColumnLines() {
		return columnLines;
	}

	public void setColumnLines(String columnLines) {
		this.columnLines = columnLines;
	}

	public String getGfield() {
		return gfield;
	}

	public void setGfield(String gfield) {
		this.gfield = gfield;
	}

	public String getGsortinfo() {
		return gsortinfo;
	}

	public void setGsortinfo(String gsortinfo) {
		this.gsortinfo = gsortinfo;
	}

	public String getGtotalfield() {
		return gtotalfield;
	}

	public void setGtotalfield(String gtotalfield) {
		this.gtotalfield = gtotalfield;
	}

	public String getGtpl() {
		return gtpl;
	}

	public void setGtpl(String gtpl) {
		this.gtpl = gtpl;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public void setPagec(String pagec) {
		this.pagec = pagec;
	}

	public String getPagec() {
		return pagec;
	}

}
